﻿using System.Linq.Expressions;

namespace Tszy.Unlimited.Data.AdoNet.Sql.Components.Expressions.Counts
{
    /// <summary>
    /// 实现 linq 中的 Min 函数。
    /// </summary>
    internal class MinExpressionExecutor : MathExpressionExecutorBase
    {
        /// <summary>
        ///
        /// </summary>
        public MinExpressionExecutor() : base(ExpressionKey.MIN)
        {
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <param name="expression"></param>
        /// <returns></returns>
        public override ExpressionExecutorResult Execute(ExpressionContext context, Expression expression)
        {
            context.Min = GetWhereMathExpressionDescriptor(context, expression);

            return ResultSuccess();
        }
    }
}